#include "Blocks/IvyBlock.h"

namespace PocketSurvival
{
    int32_t IvyBlock::getIndex()
    {
        return Index();
    }
    const std::string &IvyBlock::getBlockName()
    {
        static std::string blockName = "IvyBlock";
        return blockName;
    }

    BlockPlacementData IvyBlock::getPlacementValue(ComponentMiner *componentMiner, int32_t value, const TerrainRaycastResult &raycastResult)
    {
		BlockPlacementData result;
        if(raycastResult.cellFace.face < 4)
        {
            result.cellFace = raycastResult.cellFace;
            result.value = Terrain::MakeBlockValue(197, 0, SetFace(0, CellFace::OppositeFace(raycastResult.cellFace.face)));
        }
        return result;
    }

    const std::vector<BoundingBox> &IvyBlock::getCustomCollisionBoxes(int32_t value)
    {
        int32_t face = GetFace(Terrain::ExtractData(value));
        if (face >= 0 && face < 4)
        {
            BlockConstans::ivyCollisionBoxes[face];
        }
        return Block::getCustomCollisionBoxes(value);
    }

}